<#assign pageTitle = "我的账户" />
<#assign pageHeader>
	<link rel="stylesheet" type="text/css" href="/static/css/qrcode-dialog.css"/>
</#assign>
<#assign pageContent>
	<article class="w80 fl">
		<div class="u-r-cont">
			<section>
				<div class="">
					<section class="u-r-tit-all">
						<h2 class="unFw">
							<span class="current">
								我的账户
							</span>
						</h2>
					</section>
					<div class="u-r-all-box" id="p_tCont">
						<section class="member-all-box">
							<div class="my-oder-in of">
								<div class="myacc-l">
									<em class="m-acc-ico icon20 mr5">&nbsp;</em>
									<tt class="f-fM c-333 fsize16 vam">账户余额：共计</tt>
									<tt class="f-fM c-master fsize24 vam">￥${userAccount.balance/100}</tt>
									<#if serviceSwitch.recharge=='ON'>
										<tt class="f-fM c-999 fsize14 vam">，其中<span class="c-master">￥${userAccount.vmAmount/100}</span>来自充值</tt>
									</#if>
									<tt class="f-fM c-999 fsize14 vam">，<span class="c-master">￥${userAccount.backAmount/100}</span>来自返现。</tt>
								</div>
								<div class="myacc-r">
									<div class="myacc-r-cz">
										<em class="m-acc-cz-ico icon20 mr5">&nbsp;</em>
										<tt class="f-fM c-333 fsize16 vam">账户充值：</tt>
										<input type="text" id="payCash" class="u-a-inpt u-a-inpt-zhcz" />
										<tt class="f-fM c-333 fsize16 vam mr20">元</tt>
										<a href="javascript:void(0)" onclick="doPayCash()" title="现金充值" class="f-fM fsize14 btn-bg mr50">账户充值</a>
									</div>
									<div class="myacc-r-cz myacc-r-cz-btn">
										<#if serviceSwitch.allowDraw=='ON'>
											<a href="javascript:void (0)" onclick="accountDraw()" title="提现" class="f-fM fsize14 btn-ku mr30">提现</a>
										</#if>
										<#if serviceSwitch.recharge=='ON'>
											<a href="javascript:void (0)" onclick="accountRecharge()" title="充值卡充值" class="f-fM fsize14 btn-ku mr30">充值卡充值</a>
										</#if>
									</div>
								</div>
							</div>
							<div class="member-yt mt30">
								<div class="m-acc-title">
									<span class="f-fM">
										账户余额用途
									</span>
								</div>
								<div class="mem-body mem-b-txt">
									<p class="c-999 f-fM">
										1.账户余额可在站内购买商品。
									</p>
									<#if serviceSwitch.allowDraw=='ON'>
										<p class=" c-999 f-fM">
											2.来自返现的余额可作为现金，提现到本人绑定的银行卡。
										</p>
									</#if>
								</div>
							</div>
							<div class="member-yt mt30">
								<div class="m-acc-title">
									<span class="f-fM">
										账户充值说明：
									</span>
								</div>
								<div class="mem-body mem-b-txt">
									<p class=" c-999 f-fM ">
										1.现金充值：点击<tt class="f-fM fsize14 c-master">现金充值</tt>。支持银行卡、支付宝、微信、易支付等充值方式。
									</p>
									<#if serviceSwitch.recharge=='ON'>
										<p class="c-999 f-fM">
											2.充值卡充值：点击<tt class="f-fM fsize14 c-master">充值卡充值</tt>。充值卡仅限已登录账号使用，请在卡片有效期内充值，注意卡片信息保密。
										</p>
									</#if>
									<p class="fsize14 c-999 f-fM ">
										<tt class="f-fM  c-master">提示：</tt>充值额度不可提现。账户中金额与人民币比例为1:1，最小支持5元充值。
									</p>
								</div>
							</div>
							<#if serviceSwitch.allowDraw=='ON'>
								<div class="member-yt mt30">
									<div class="m-acc-title">
										<span class="f-fM">
											账户提现说明：
										</span>
									</div>
									<div class="mem-body mem-b-txt">
										<p class=" c-999 f-fM">
											点击<tt class="f-fM fsize14 c-master">余额提现</tt>，账户内来自返现金额可全部提现到登录账号所绑定的银行卡内。提现过程中，提现的金额会处于冻结状态，提现审核通过，将自动转入银行卡内，请注意查收。
										</p>
									</div>
								</div>
							</#if>
							<div class="member-jl mt30">
								<div class="m-acc-title">
									<aside class="fr m-acc-sou mr30">
										<form action="/user/account.html" name="searchForm" id="searchForm" method="post">
											<input id="pageCurrentPage" type="hidden" name="page" value="${page.currentPage}"/>
											<tt class="f-fM fsize14 c-666">类型查找：</tt>
											<select name="actHistoryType" onchange="$('#searchForm').submit()" id="actHistoryType">
												<option value="" >全部</option>
												<option value="SALES" >站内消费</option>
												<option value="CASHLOAD">账户充值</option>
												<#if serviceSwitch.recharge=='ON'>
													<option value="VMLOAD">充值卡充值</option>
												</#if>
												<#if serviceSwitch.allowDraw=='ON'>
													<option value="DRAWMONEY">余额提现</option>
												</#if>
												<option value="BACKMONEY">返现</option>
												<option value="ADMINLOAD">后台充值</option>
											</select>
										</form>
									</aside>
									<span class="f-fM">
										账户使用记录
									</span>
									<div class="clear"></div>
								</div>
								<div class="mem-body">
									<#if accList??>
										<table class="member-jl-tab" width="100%" cellspacing="0" cellpadding="0" border="0">
											<thead>
											<tr>
												<th align="center">金额</th>
												<th align="center">类型</th>
												<th align="center">日期</th>
												<th align="center" class="mobile-none">余额</th>
												<th align="center">备注</th>
											</tr>
											</thead>
											<tbody>
											<#list accList as accountHistory>
												<tr>
													<td align="center">
														<#if accountHistory.actHistoryType!='SALES'>
															<span class="u-ass-zc f-fM">${accountHistory.orderAmount/100}</span>
														</#if>
														<#if accountHistory.actHistoryType=='SALES'>
															<span class="u-ass-gq f-fM">${accountHistory.orderAmount/100}</span>
														</#if>
													</td>
													<td align="center">
														<#if accountHistory.actHistoryType=='SALES'>
															消费
														</#if>
														<#if accountHistory.actHistoryType=='REFUND'>
															退款
														</#if>
														<#if accountHistory.actHistoryType=='CASHLOAD'>
															现金充值
														</#if>
														<#if accountHistory.actHistoryType=='VMLOAD'>
															充值卡充值
														</#if>
														<#if accountHistory.actHistoryType=='DRAWMONEY'>
															提现
														</#if>
														<#if accountHistory.actHistoryType=='BACKMONEY'>
															返现
														</#if>
														<#if accountHistory.actHistoryType=='ADMINLOAD'>
															后台充值
														</#if>
													</td>
													<td align="center">${accountHistory.createTime?string("yyyy/MM/dd")}</td>
													<td align="center" class="mobile-none">${accountHistory.balance/100}</td>
													<td align="center">
														${accountHistory.description}
													</td>
												</tr>
											</#list>
											</tbody>
										</table>
										<!-- 公共分页 开始 -->
										<div class="paging" id="showPages"></div>
										<!-- 公共分页 结束 -->
									<#else>
										<section class="no-data-wrap">
											<em class="icon30 no-data-ico">&nbsp;</em> <span class="c-666 fsize14 ml10 vam">没有相关数据，小编正在努力整理中...</span>
										</section>
									</#if>
								</div>
							</div>
						</section>
					</div>
				</div>
			</section>
		</div>
	</article>
</#assign>
<#assign pageFooter>
	<script type="text/javascript" src="/static/js/page.js"></script>
	<script type="text/javascript">
		var options = {
			currentPage : ${page.currentPage}
			,totalPage : ${totalPages}
		};
		$(function () {
			showPages(options);
		});
	</script>
</#assign>
<#include "../layouts/layout_uc.ftl">
<script type="text/javascript" src="/static/js/uc-dialog.js"></script>
<script type="text/javascript" src="/static/js/order.js?v=1"></script>
<script type="text/javascript" src="/static/js/wxJSAPI.js"></script>
<script type="text/javascript" src="/static/libs/layui-v2.6.8/layui.js"></script>
<script type="text/javascript" src="/static/libs/jquery/jquery.qrcode.min.js"></script>
<script>
	$(function(){
		$("#actHistoryType").val("${actHistoryType!}");
	});
	function doPayCash() {
		var payCash = $("#payCash").val();
		if (payCash == null || payCash === '') {
			return layer.msg('请输入充值金额！');
		}
		var reg = /^[0-9]+(.[0-9]{1,2})?$/;
		if (isNaN(payCash) || !reg.test(payCash)) {
			return layer.msg('请输入正确的充值金额！');
		}
		if (payCash < 5) {
			return layer.msg('充值金额不能少于5元！');
		}
		var params = {
			'orderType': 'ACCOUNT',
			'payType': 'WXPAY',
			'amount': parseInt(payCash) * 100
		}
		orderCreate(params);
	}
</script>